﻿using System;
using System.Collections.Generic;

namespace SimpleService.Database
{
    public class DbProvider
    {
        /// <summary>
        /// 動態產生Provider
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static IDbProvider Get( string type) { 
            try
            {
                Dictionary<string, Type> DbTypes = DbLoader.GetDbTypes();                
                Type DbType = DbTypes[type];
                return (IDbProvider)Activator.CreateInstance(DbType);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        
    }
}
